
def linear_search(data, target):
    for idx, val in enumerate(data):
        if val == target:
            return idx
    return -1


data = [29, 18, 8, 91, 88, 31]
print(linear_search(data, 88)) # 4
print(linear_search(data, 20)) # -1